/*using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace KLib.Graphics
{
    /// <summary>
    /// *OBSOLETE: Use KLib.Graphics.SpriteBatch instead. It contains a more efficiant way to render sprites*
    /// </summary>
    [Obsolete("Use KLib.Graphics.SpriteBatch instead. It contains a more efficiant way to render sprites",false)]
    public class SpriteRenderer2
    {
        #region Fields
        private VertexPositionColorTexture[] vertices;
        private short[] indices;
        private int vertexCount = 0;
        private int indexCount = 0;
        private Texture2D texture;
        private VertexDeclaration vertDec;
        private GraphicsDevice graphics;

        private Matrix world;
        private Matrix view;
        private Matrix projection;

        private Effect effect;
        private ContentManager content;
        #endregion

        #region Properties
        public Effect Effect
        {
            get { return effect; }
            set { effect = value; }
        }
        #endregion

        #region Initialziation
        public SpriteRenderer2(GraphicsDevice graphics, ContentManager content)
        {
            this.graphics = graphics;
            vertices = new VertexPositionColorTexture[256];
            indices = new short[vertices.Length * 3 / 2];
            this.content = content;
            effect = content.Load<Effect>("Effects/spriteRenderer");
        }
        #endregion

        #region Methods
        public void Prepare(int width, int height)
        {
            this.world = Matrix.Identity;
            this.view = new Matrix(
                1.0f, 0.0f, 0.0f, 0.0f,
                0.0f, -1.0f, 0.0f, 0.0f,
                0.0f, 0.0f, -1.0f, 0.0f,
                0.0f, 0.0f, 0.0f, 1.0f);
            this.projection = Matrix.CreateOrthographicOffCenter(0, width, -height, 0, 0, 1);
        }

        public void End()
        {
            this.Flush();
        }
        /// <summary>
        /// Draws a Sprite to the screen at its position
        /// </summary>
        /// <param name="sprite">The Sprite to draw</param>
        public void Draw(Sprite sprite)
        {
            Draw(sprite.Texture, sprite.Position);
        }

        /// <summary>
        /// Draws the current frame of a AnimatedSprite at its position
        /// </summary>
        /// <param name="sprite">The AnimatedSprite to draw</param>
        public void Draw(AnimatedSprite sprite)
        {
            Draw(sprite.Texture,sprite.FrameRectanle,new Rectangle((int)sprite.Position.X,(int)sprite.Position.Y,sprite.Texture.Width,sprite.Texture.Height));
        }
        /// <summary>
        /// Draws a Texure2D to the screen at the specified position
        /// </summary>
        /// <param name="texture">The Texture to draw</param>
        /// <param name="position">The Position to draw the texture at</param>
        public void Draw(Texture2D texture, Vector2 position)
        {
            Draw(texture, new Rectangle(0, 0, texture.Width, texture.Height), new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height));
        }

        /// <summary>
        /// Draws a portion of a sprite to a portion of the screen
        /// </summary>
        /// <param name="texture">The Texture to draw</param>
        /// <param name="sourceRect">The rectangle specifing what part of the Texture to draw</param>
        /// <param name="destRect">The Rectangle specifing what part of the screen to draw the texture</param>
        public void Draw(Texture2D texture, Rectangle sourceRect, Rectangle destRect)
        {
            //if the texture has changed, draw queued sprites and start again
            if (this.texture != null || this.texture != texture)
            {
                this.texture = texture;
                this.Flush();
            }

            //Make sure that there is enough room for the new indices and vertices
            EnsureSpace(6, 4);

            //Add the new indices
            indices[indexCount++] = (short)(vertexCount + 0);
            indices[indexCount++] = (short)(vertexCount + 1);
            indices[indexCount++] = (short)(vertexCount + 3);
            indices[indexCount++] = (short)(vertexCount + 1);
            indices[indexCount++] = (short)(vertexCount + 2);
            indices[indexCount++] = (short)(vertexCount + 3);

            //Add the new Vertices
            vertices[vertexCount++] = new VertexPositionColorTexture(new Vector3(destRect.Left, destRect.Top, 0), Color.White, GetUV(sourceRect.Left, sourceRect.Left));
            vertices[vertexCount++] = new VertexPositionColorTexture(new Vector3(destRect.Right, destRect.Top, 0), Color.White, GetUV(sourceRect.Right, sourceRect.Left));
            vertices[vertexCount++] = new VertexPositionColorTexture(new Vector3(destRect.Right, destRect.Bottom, 0), Color.White, GetUV(sourceRect.Right, sourceRect.Bottom));
            vertices[vertexCount++] = new VertexPositionColorTexture(new Vector3(destRect.Left, destRect.Bottom, 0), Color.White, GetUV(sourceRect.Left, sourceRect.Bottom));

        }
  #endregion

        #region Helper Methods
        private void EnsureSpace(short indexSpace, short vertexSpace)
        {
            if (indexCount + indexSpace >= indices.Length)
                Array.Resize(ref indices, Math.Max(indexCount + indexSpace, indices.Length * 2));
            if (indexCount + vertexSpace >= vertices.Length)
                Array.Resize(ref vertices, Math.Max(indexCount + indexSpace, vertices.Length * 2));
        }

        private Vector2 GetUV(int x, int y)
        {
            return new Vector2(x / (float)this.texture.Width,y/ (float)this.texture.Height);
        }

        private void Flush()
        {
            if (this.vertexCount > 0)
            {
                if (this.vertDec == null || this.vertDec.IsDisposed)
                    this.vertDec = new VertexDeclaration(graphics, VertexPositionColorTexture.VertexElements);

                graphics.VertexDeclaration = vertDec;

                effect.Parameters["Projection"].SetValue(this.projection);
                effect.Parameters["Texture"].SetValue(this.texture);

                effect.Begin();
                effect.CurrentTechnique.Passes[0].Begin();

                graphics.DrawUserIndexedPrimitives<VertexPositionColorTexture>(PrimitiveType.TriangleList, vertices, 0, vertexCount, indices, 0, indexCount / 3);

                effect.CurrentTechnique.Passes[0].End();
                effect.End();

                this.vertexCount = 0;
                this.indexCount = 0;
            }
        }
        #endregion
    }
}*/